home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 March: Reference Library / Dev.CD Mar 96 RL / Dev.CD Mar 96 RL.toast / Technical Documentation / develop / develop Issue 25 / develop Issue 25 code / QD3D to QTVR / ArticleCode / Source / draw.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-21  |  1.8 KB  |  63 lines  |  [TEXT/MPCC]

  1. #include "QD3DtoQTVR.h"
  2. #include "extern.h"
  3. #include "draw.h"
  4.  
  5.  
  6. void MyDrawOnScreen(DocumentPtr theDocument)
  7. {
  8.     LockPixels(theDocument->drawContextOffscreen->portPixMap);
  9.     SetGWorld(theDocument->theWindow,nil);
  10.     CopyBits((BitMap*)&theDocument->drawContextOffscreen->portPixMap,
  11.                 (BitMap*)&theDocument->theWindow->portPixMap,
  12.                  &theDocument->drawContextOffscreen->portRect, 
  13.                  &theDocument->theWindow->portRect, 
  14.                  srcCopy, 
  15.                  nil);
  16.     UnlockPixels(theDocument->drawContextOffscreen->portPixMap);
  17. }
  18.  
  19.  
  20. TQ3Status MyDrawOffScreen(DocumentPtr theDocument)
  21. {
  22.     TQ3DrawContextObject    drawCtx;
  23.     TQ3Vector3D                globalScale;
  24.     TQ3Vector3D                globalTranslate;
  25.     RGBColor                 whiteColor = kMyWhiteColor;
  26.     RGBColor                blackColor = kMyBlackColor;
  27.     GWorldPtr                oldPort;
  28.     GDHandle                oldGD;
  29.     
  30.     GetGWorld(&oldPort,&oldGD);
  31.     
  32.     if(theDocument == NULL)
  33.         return kQ3Success;
  34.         
  35.     Q3View_GetDrawContext(theDocument->theView, &drawCtx);
  36.     
  37.     if( theDocument->documentGroup ) {
  38.         globalScale.x = globalScale.y = globalScale.z = theDocument->documentGroupScale;
  39.         Q3Vector3D_Scale(&globalTranslate, -1, &globalTranslate);
  40.         Q3View_StartRendering(theDocument->theView);
  41.         
  42.         do {                
  43.             TQ3SubdivisionStyleData        subData = {kQ3SubdivisionMethodConstant, 20, 20};
  44.         
  45.             Q3Shader_Submit(theDocument->illuminationShader, theDocument->theView);
  46.                                             
  47.             Q3InterpolationStyle_Submit(theDocument->currentInterpolation,theDocument->theView);
  48.             
  49.             Q3SubdivisionStyle_Submit( &subData,theDocument->theView);
  50.             
  51.             Q3MatrixTransform_Submit( &theDocument->modelRotation, theDocument->theView);
  52.             Q3ScaleTransform_Submit(&globalScale, theDocument->theView);
  53.                         
  54.             Q3DisplayGroup_Submit(theDocument->documentGroup, theDocument->theView);
  55.         } while (Q3View_EndRendering(theDocument->theView) == kQ3ViewStatusRetraverse);
  56.     }
  57.     
  58.     Q3Object_Dispose( drawCtx );
  59.     SetGWorld(oldPort,oldGD);
  60.     
  61.     return(kQ3Success);
  62. }
  63.